#!/usr/bin/env gawk -f
# 
# Build the .dot file corresponding to the wmap.out from wmap.py

# Usage:
#	./wmap2dot <wmap.out >wmap.dot
#	neato -Tpdf <wmap.dot >wmap.pdf

# For the wrekagrid project, 

# September 2007, Basile Clout

BEGIN{
	pad = 3;
	{print "digraph wrekanet {\n"}
}

NR > 8 {		# Skip 8 first lines (6 of comments, 2 useless for the drawing
	node=NR-9;
	print "\t" node " [label=\"" node " (" $1 ")\"];";
	i=2;
	while(i<NF){
		print "\t" node " -> " $i " [label=\"" $(i+1) "\\n" $(i+2) "\"];";
		i+=3;
		}
	} 

END {
	{print "}"}
}
